package com.cap.bts.crmdp.dealer.redemption.domain;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.AttributeOverride;
import javax.persistence.AttributeOverrides;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;

import com.cap.bts.crmdp.dealer.activation.domain.PackageRedemptionLines;
import com.cap.bts.framework.common.domain.BaseDomain;


/**
 * The persistent class for the tm_member_package_redemption database table.
 * 
 */
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
@Entity
@Table(name="TM_MEMBER_PACKAGE_REDEMPTION")
@AttributeOverrides({
    @AttributeOverride(name="createBy", column=@Column(name="CREATE_BY")),
    @AttributeOverride(name="createDate", column=@Column(name="CREATE_DATE", nullable = false)),
    @AttributeOverride(name="lastUpdateBy", column=@Column(name="LAST_UPDATE_BY")),
    @AttributeOverride(name="lastUpdateDate", column=@Column(name="LAST_UPDATE_DATE"))
})
public class MemberPackageRedemption extends BaseDomain implements Serializable {

    private static final long serialVersionUID = 6441972827279522682L;

    private Long id;

	private String activicationCode;

	private String description;

	private PackageRedemptionLines packageRedemptionLine;

	private Long packageId;

	private Date redeemDate;

	private String salesOrder;

	private String salesOrderLine;

	private String shortName;

	private Integer status;
	
	private Integer marsLockStatus;
	
	private String soNumberRedeem;
	
	private String soNumberSettle;
	
	private String soNumberCancel;

	public MemberPackageRedemption() {
	}

	@Id
	@GeneratedValue(strategy=GenerationType.AUTO)
	public Long getId() {
		return this.id;
	}

	public void setId(Long id) {
		this.id = id;
	}

    @Column(name="ACTIVATION_CODE")
	public String getActivicationCode() {
		return this.activicationCode;
	}

	public void setActivicationCode(String activicationCode) {
		this.activicationCode = activicationCode;
	}


	public String getDescription() {
		return this.description;
	}

	public void setDescription(String description) {
		this.description = description;
	}


	
    /**
     * @Date        :      2015年9月9日
     *
     * @return the packageRedemptionLine
     */
	@ManyToOne(optional = true, targetEntity = PackageRedemptionLines.class)
    @JoinColumn(name = "LINE_ID", referencedColumnName = "ID")
    public PackageRedemptionLines getPackageRedemptionLine() {
        return packageRedemptionLine;
    }

    /**
     * @Date        :      2015年9月9日
     *
     * @param packageRedemptionLine the packageRedemptionLine to set
     */
    public void setPackageRedemptionLine(PackageRedemptionLines packageRedemptionLine) {
        this.packageRedemptionLine = packageRedemptionLine;
    }

    @Column(name="PACKAGE_ID")
	public Long getPackageId() {
		return this.packageId;
	}


	public void setPackageId(Long packageId) {
		this.packageId = packageId;
	}

	@Temporal(TemporalType.DATE)
	@Column(name="REDEEM_DATE")
	public Date getRedeemDate() {
	    if(redeemDate!=null){
            return new Date(redeemDate.getTime());
        }else{
            return null;
        }
	}

	public void setRedeemDate(Date redeemDate) {
	    if(redeemDate!=null){
            this.redeemDate = new Date(redeemDate.getTime());
        }else{
            this.redeemDate =null;
        }
	}

	@Column(name="SALES_ORDER")
	public String getSalesOrder() {
		return this.salesOrder;
	}

	public void setSalesOrder(String salesOrder) {
		this.salesOrder = salesOrder;
	}

	@Column(name="SALES_ORDER_LINE")
	public String getSalesOrderLine() {
		return this.salesOrderLine;
	}

	public void setSalesOrderLine(String salesOrderLine) {
		this.salesOrderLine = salesOrderLine;
	}

	@Column(name="SHORT_NAME")
	public String getShortName() {
		return this.shortName;
	}

	public void setShortName(String shortName) {
		this.shortName = shortName;
	}
	@Column(name="STATUS")
	public Integer getStatus() {
		return this.status;
	}

	public void setStatus(Integer status) {
		this.status = status;
	}

	@Column(name="MARS_LOCK_STATUS")
    public Integer getMarsLockStatus() {
        return marsLockStatus;
    }

    public void setMarsLockStatus(Integer marsLockStatus) {
        this.marsLockStatus = marsLockStatus;
    }

    @Column(name="SO_NUMBER_REDEEM")
    public String getSoNumberRedeem() {
        return soNumberRedeem;
    }

    public void setSoNumberRedeem(String soNumberRedeem) {
        this.soNumberRedeem = soNumberRedeem;
    }

    @Column(name="SO_NUMBER_SETTLE")
    public String getSoNumberSettle() {
        return soNumberSettle;
    }

    public void setSoNumberSettle(String soNumberSettle) {
        this.soNumberSettle = soNumberSettle;
    }

    @Column(name="SO_NUMBER_CANCEL")
    public String getSoNumberCancel() {
        return soNumberCancel;
    }

    public void setSoNumberCancel(String soNumberCancel) {
        this.soNumberCancel = soNumberCancel;
    }

}